package com.itheima.controller.admin;

import com.itheima.common.result.PageResult;
import com.itheima.common.result.Result;
import com.itheima.dto.YddLinkDTO;
import com.itheima.dto.YddLinkPageQueryDTO;
import com.itheima.pojo.YddLink;
import com.itheima.pojo.YddTag;
import com.itheima.service.YddLinkService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/ydd_link")
@Api(tags = "广告链接管理")
public class YddLinkController {

    @Autowired
    private YddLinkService yddLinkService;

    @GetMapping("/list")
    public Result<PageResult> page(YddLinkPageQueryDTO dto){return yddLinkService.pageYddLink(dto);}
    @PostMapping("/add")
    public Result addYddLink(@RequestBody YddLinkDTO dto){return yddLinkService.addYddLink(dto);}
    @GetMapping("/del")
    public Result deleteById(Integer id){return yddLinkService.deleteById(id);}
    @GetMapping("/rowInfo")
    public Result getData(Integer id){return Result.success(yddLinkService.getById(id));}
    @PostMapping("/update")
    public Result update(@RequestBody YddLink yddLink){return Result.success(yddLinkService.updateById(yddLink));}

}
